package com.zhuang.work0430.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhuang.work0430.entity.UserType;
import com.zhuang.work0430.service.UserTypeService;
import com.zhuang.work0430.util.ResponseJSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhuang
 * @since 2021-04-30
 */
@RestController
@RequestMapping("/userType")
public class UserTypeController {
    @Autowired
    private UserTypeService userTypeService;

    @RequestMapping("typeList.json")
    public ResponseJSON findTypes(@RequestBody UserType userType) {
        QueryWrapper<UserType> wrapper = new QueryWrapper<>(userType);
        List<UserType> userTypes = userTypeService.getBaseMapper().selectList(wrapper);
        ResponseJSON json = null;
        if (userTypes != null) {
            return json = new ResponseJSON("200", "success", userTypes);
        }
        return json = new ResponseJSON("500", "error", null);
    }

}

